Simplifications to partial_eval_preserves_typeof#896
Simplifications to partial_eval_preserves_typeof#896john-h-kastner-aws merged 2 commits intomainfrom
Conversation
Signed-off-by: John Kastner <jkastner@amazon.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors the partial_eval_preserves_typeof theorem to a simpler statement (PEPreservesTypeOf res) that depends only on Residual.WellTyped and the chosen (preq, pes), and then updates downstream well-typedness lemmas to use the new interface.
Changes:
- Redefines
PEPreservesTypeOfto quantify over{env}and(preq, pes), and restatespartial_eval_preserves_typeofas∀ res, PEPreservesTypeOf res. - Updates
partial_eval_preserves_typeof_*helper proofs to match the newPEPreservesTypeOfsignature. - Adjusts many call sites in
WellTypedCases.leanto the newpartial_eval_preserves_typeofAPI.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 20 comments.
| File | Description |
|---|---|
cedar-lean/Cedar/Thm/TPE/WellTypedCases.lean |
Updates numerous proof steps to use the new partial_eval_preserves_typeof signature. |
cedar-lean/Cedar/Thm/TPE/PreservesTypeOf.lean |
Refactors the main preservation theorem and its helpers to a simplified PEPreservesTypeOf formulation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cdisselkoen
left a comment
There was a problem hiding this comment.
Great simplification. I assume you checked whether we can remove any hypotheses from the proofs up the stack, similar to how we're removing unneeded hypotheses from this definition?
| RequestAndEntitiesRefine req es preq pes → | ||
| Residual.WellTyped env res → | ||
| (TPE.evaluate res preq pes).typeOf = res.typeOf | ||
| abbrev PEPreservesTypeOf (res : Residual) : Prop := |
There was a problem hiding this comment.
Not related to this PR, but -- curious why this is abbrev instead of def?
There was a problem hiding this comment.
It compiles with def, so idk. Quick search says Lean is more willing to automatically unfold abbrevs.
I feel like I shouldn't need |
Issue #, if available:
Description of changes: